/*QGraphicsView obj as centralWidget in mainwindow
 *it contains a QGraphicsScene obj
 *all QGraphicsItem are operated in scene obj
 *slots&signals in this file do some info-transmission job
 *between mainwindow and scene*/

#ifndef BOARD_H
#define BOARD_H

#include <QGraphicsView>

class BoardScene;
class QString;
class QFile;
class Settings;

class Board : public QGraphicsView
{
    Q_OBJECT //a macro from QT, u can use QObject functions with this macro
             //and is necessary for "moc", at least i think so

public:
    Board(QWidget *parent=0); //constructor

    void newGame(); //will delete old scene obj and
                    //create a new QGraphicsScene obj
                    //mostly items are in scene obj

public slots:
    void setShowGrid(bool);
    void setShowIndex(bool);
    void startReview();
    void backToFirst();
    void jumpBackward();
    void backward();
    void forward();
    void jumpForward();
    void goToEnd();
    void backToInit();
    void quitReview();
    void regret();
    void startJudgment();
    void showJudgment(QString);
    void pass();
    void aiMove();

    void changeHandicaps(int);

    void outputSGF(QFile*, Settings*);
    void inputSGF(QFile*, Settings*);
    void output2DBoard(const char*);

       signals:
    void changeButtonToFalse();
    void openReview();
    void closeReview();
    void disableGameSettings();
    void enableGameSettings();
    void passIfShowIndex(bool);
    void disableShowIndex();
    void enableShowIndex();
    void windowIsModified();
    void loadSucceed();
    void loadFailed();

private:
    bool ifShowIndex;

    BoardScene *scene; //scene to display a gameboard and oprating on it

private:
    void createScene(); //contained in constructor, it will
                        //create a scene obj as soon as a
                        //view obj been created
};

#endif // BOARD_H
